<template>
<div class='bigForm'>
  <el-button class='bacToIndex' size="mini" @click="backtoIndex">返回首页</el-button>
  <el-dialog width="600px" top='35vh' :closeOnClickModal='false' :showClose='false' title="请确认符合以下条件" :visible.sync="dialogFormVisible">
    <el-checkbox v-model="checked1">申请前未在太仓市范围内注册成立过公司、缴纳过社会保险、个人所得税；</el-checkbox>
    <el-checkbox v-model="checked2">具有全日制本科及以上学历，且获得相应学位；</el-checkbox>
    <el-checkbox v-model="checked3">无违法犯罪、不良信用记录；</el-checkbox> <br>
    <el-checkbox v-model="checked4">申报人年龄45周岁（含）以下。</el-checkbox>
    <div slot="footer" class="dialog-footer">
      <!-- <el-button type="primary" @click="ifAllAgree">返 回</el-button> -->
      <el-button type="primary" @click="ifAllAgree">确 定</el-button>
    </div>
  </el-dialog>
<el-dialog width="600px"  :closeOnClickModal='false' :showClose='false'  :visible.sync="dialogFormVisible2">
  <div>
    <h3 style="text-align: center; ">太仓市大学生创业园入园承诺书</h3>
    <h4>本人/本企业做出以下承诺：</h4>
    <div>
      1．提交的申请材料中所涉及的文件、证件及有关附件真实有效，复印件与原件一致；<br>
      2．所获的资助资金专用于创业项目公司保障项目开展、公司经营、日常办公所需的支出，不得用于职工福利发放、业务招待等非经营性支出；<br>
      3．积极配合园区管理方提供创业项目公司相应的支出凭证； <br>
      4．严格遵守国家的有关法律法规和园区相关规章制度。
      <h4>
        在申请创业项目资金及入驻园区的过程中，本人/本企业若作出虚假承诺或违反相关政策规定，愿负相应的法律责任，并承担由此产生的一切后果（包括但不限于退回已获得的本项目资金以及依据相关政策文件所享受的其他奖励、补贴等）。园区管理方有权利追究本人/本企业的相关责任。
      </h4>
    </div>   
    <div style="padding-top: 10px;">     
      <el-row>
         签名：
        <el-popover
          placement="bottom"
          trigger="click">
          <foot-market :type='1' @update='updateSignNUm2'></foot-market>
          <el-button slot="reference" class="signBtn" style="margin-right: 10px;" type="primary" plain>手机扫码添加签名</el-button>
        </el-popover>
        <el-button type="primary" plain @click="getSignStore2">更新签名</el-button>
      </el-row>
      <el-row v-show='form.signPromise'>
        <el-image style="width: 100px; height: 100px" :src="form.signPromise"></el-image>
        <el-button type="danger" icon="el-icon-delete" circle @click="form.signPromise = ''"></el-button>
      </el-row>      
    </div>
  </div>
  <div slot="footer" class="dialog-footer">
    <el-button type="default" @click="ifAgreeAgreement(false)">不同意</el-button>
    <el-button type="primary" @click="ifAgreeAgreement(true)" :disabled="delTime != 0">同 意({{delTime}}s)</el-button>
  </div>
</el-dialog>

<el-dialog width="600px" title="欢迎登陆" center :closeOnClickModal='false' :showClose='false'  :visible.sync="dialogFormVisible3">
  <div>
    <el-form v-if='loging' :model="form2" :rules="rules2" ref="form2">
      <el-tabs v-model="activeTab">
        <el-tab-pane label="账号密码登录" name="tab1"></el-tab-pane>
        <el-tab-pane label="手机号登录" name="tab2"></el-tab-pane>
      </el-tabs>
      <div class="content" v-if="activeTab === 'tab1'">
        <el-form-item label="用户名" prop='username'>
            <el-input v-model="form2.username" placeholder="请输入用户名"></el-input>
          </el-form-item>
          <el-form-item label="密码" prop='password'>
            <el-input v-model="form2.password" placeholder="请输入密码" type="password"></el-input>
          </el-form-item>
      </div>
      <div class="content" v-else>
        <el-row>
        <el-form-item label="手机号" prop='mobile'>
            <el-input v-model="form2.mobile" placeholder="请输入手机号"></el-input>
          </el-form-item>
        </el-row>
        <el-row :gutter='20' type="flex" align="bottom">
          <el-col :span='18'>
            <el-form-item label="验证码" prop='captcha'>
              <el-input v-model="form2.captcha" placeholder="请输入短信验证码"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span='6'>
            <el-button type="primary" :disabled="codeDel != 60" style="margin-bottom: 22px;" @click="getIdCode('MEMBER_LOGIN')">{{codeMsg}}</el-button>
          </el-col>
        </el-row>  
          <!-- <el-form-item label="验证码" prop='captcha'>
            <el-input v-model="form2.captcha" placeholder="请输入验证码" type="password"></el-input>
          </el-form-item>         -->
      </div>     
    </el-form>
    <el-form v-else :model="form2" :rules="rules2" ref="form2">      
      <el-form-item label="用户名" prop='username'>
        <el-input v-model="form2.username" placeholder="请输入用户名"></el-input>
      </el-form-item>
      <el-form-item label="密码" prop='password'>
        <el-input v-model="form2.password" placeholder="至少六位，区分大小写" type="password"></el-input>
      </el-form-item>
      <el-form-item label="确认密码" prop='password2'>
        <el-input v-model="form2.password2" placeholder="确认密码" type="password"></el-input>
      </el-form-item>    
      <el-form-item label="手机号" prop='mobile'>
        <el-input v-model="form2.mobile" placeholder="11位手机号">
          <template slot="prepend">+86</template>
        </el-input>
      </el-form-item>  
      <el-row :gutter='20' type="flex" align="bottom">
        <el-col :span='18'>
          <el-form-item label="验证码" prop='captcha'>
            <el-input v-model="form2.captcha" placeholder="请输入短信验证码"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-button type="primary" :disabled="codeDel != 60" style="margin-bottom: 22px;" @click="getIdCode('MEMBER_REGISTER')">{{codeMsg}}</el-button>
        </el-col>
      </el-row>                  
    </el-form>
  </div>
  <div slot="footer" v-if='loging' class="dialog-footer">
    <div>                    
        <el-button type="text" @click="backtoIndex">返回首页</el-button>
    </div>
    <el-button type="default" @click="changeLogin(false)">去注册</el-button>
    <el-button type="primary" @click="toLoging">登录</el-button>
  </div>
  <div slot="footer" v-else class="dialog-footer">
    <el-button type="default" @click="changeLogin(true)">返回</el-button>
    <el-button type="primary" @click="toRegister">注册</el-button>
  </div>
  <Verify
    @success="capctchaCheckSucc"
    :mode="'pop'"
    :captchaType="'blockPuzzle'"
    :imgSize="{ width: '330px', height: '155px' }"
    ref="verify"
  ></Verify>
</el-dialog>
 <div class='flyCode'>
    <img src="../../assets/code2.png" alt="">
    <el-button icon="el-icon-d-arrow-left" v-show="!hiddenImg" circle @click="ifHidden(true)"></el-button>
    <el-button icon="el-icon-d-arrow-right" v-show="hiddenImg" circle @click="ifHidden(false)"></el-button>
  </div>
 <div id='request'>  
  <img class='banner' src="../../assets/formTop.jpg" alt="">
  <div class='historyRequest' v-if='hasHis'>
    <!-- <div class='title'>太仓市大学生创业园入园申请表</div> -->
    <el-table :data="historyList" border style="width: 100%" >
      <el-table-column label="申请表" style="color: red;">太仓市大学生创业园入园</el-table-column>
      <el-table-column prop="name2" label="申请人" width="150"></el-table-column>
      <el-table-column prop="status" label="审核状态">
        <template slot-scope="scope">
          <!-- {{scope.row.status == 0 ? '待审核' : (scope.row.status == 1 ? '通过' : '驳回')}} -->
          <el-tag v-if="scope.row.status == -2" type="danger">审批不通过</el-tag>
          <el-tag v-if="scope.row.status == -1" type="warning">退回修改</el-tag>
          <el-tag v-if="scope.row.status == 3" type="info">待园区负责人审批</el-tag>
          <el-tag v-if="scope.row.status == 4" type="success">审批通过</el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="commentParkLeader" label="审核回复" width="280"></el-table-column>
      <!-- <el-table-column label="操作" width="80">
        <template slot-scope="scope">
          <el-button v-if="scope.row.status == -1" size="mini" type="primary" plain @click="detail(scope.$index, scope.row, false)">修改</el-button>
        </template>
      </el-table-column> -->
    </el-table>
    <!-- <h5 style="text-align:center; color: red; margin: 10px 0 0 0;">提醒：除退回修改外，无需再次提交</h5> -->
  </div>
  <div class='outLoginDiv'>
    <el-popover
      placement="top"
      width="160"
      class="outLogin"
      v-model="popVisible"
      >
      <p>确定登出该账号？</p>
      <div style="text-align: right; margin: 0">
        <el-button size="mini" type="text" @click="popVisible = false">取消</el-button>
        <el-button type="primary" size="mini" @click="loginOut">确定</el-button>
      </div>
      <el-button slot="reference" type='primary' size='mini'>登出</el-button>
      
              <!-- <el-button slot="reference" size="mini" type="primary" @click="download">下载</el-button> -->
    </el-popover>
  </div> 
  
  <el-form :model='form' :disabled='ifDisabled' ref="form" :rules="rules" label-position='left'>
    <div class='title'>   
      <!-- <el-popover
        placement="top"
        width="160"
        class="outLogin"
        v-model="popVisible"
        >
        <p>确定登出该账号？</p>
        <div style="text-align: right; margin: 0">
          <el-button size="mini" type="text" @click="popVisible = false">取消</el-button>
          <el-button type="primary" size="mini" @click="loginOut">确定</el-button>
        </div>
        <el-button slot="reference" type='primary' size='mini'>登出</el-button>
      </el-popover>    -->
      太仓市大学生创业园入园申请表
    </div>
    <!-- <el-row :gutter="20">
      <el-col :span='24'>
        <el-form-item>
          <div>申请说明</div>
          <div class='requestDetail'>
            1.申请前未在太仓市范围内注册成立过公司、缴纳过社会保险、个人所得税；<br>
            2.具有全日制本科及以上学历，且获得相应学位；<br>
            3.无违法犯罪、不良信用记录；<br>
            4.申报人年龄45周岁（含）以下。
          </div>
        </el-form-item>
      </el-col>
    </el-row> -->
    <el-row :gutter="20">
      <el-col :span='12'>
        <el-form-item label="姓名" prop='name'>
          <el-input v-model='form.name'></el-input>
        </el-form-item>
      </el-col>
      <el-col :span='6'>
        <el-form-item label="性别" prop='sex'>
          <el-radio-group v-model="form.sex">
            <el-radio label="男">男</el-radio>
            <el-radio label='女'>女</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-col>
      <el-col :span='6'>
        <el-form-item label="免冠照片 (1M以内)" label-width="100px" :required="true">
            <el-upload
              class="avatar-uploader"
              :action="actionUrl"
              :show-file-list="false"
              :on-success="handleAvatarSuccess"
              :before-upload="beforeAvatarUpload"
              accept=".jpg,.png,.pdf"
              >
              <img v-if="form.filePhoto.length" :src="form.filePhoto[0].response ? form.filePhoto[0].response.url : form.filePhoto" class="avatar">
              <!-- <img v-if="form.filePhoto.length" :src="form.filePhoto[0].response.url" class="avatar"> -->
              <i v-else class="el-icon-plus avatar-uploader-icon">
                <span style='font-size:14px'>点击添加</span>
              </i>
            </el-upload>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <!-- <el-col :span='12'>
        <el-form-item label="籍贯" prop='region'>
          <el-input v-model="form.region"></el-input>
        </el-form-item>
      </el-col> -->
      <el-col :span='12'>
        <el-form-item label="最高学历" prop='education'>
          <el-select v-model="form.education" placeholder="请选择">
            <el-option label="博士" value="博士"></el-option>   
            <el-option label="博士在读" value="博士在读"></el-option>            
            <el-option label="硕士" value="硕士"></el-option>         
            <el-option label="硕士在读" value="硕士在读"></el-option>
            <el-option label="本科" value="本科"></el-option>
          </el-select>
          <!-- <el-input v-model="form.education"></el-input> -->        
        </el-form-item>
      </el-col>
      <el-col :span='12'>
        <el-form-item label="证件号码（身份证、台胞证）" prop='idCard'>
          <el-input v-model="form.idCard"></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span='12'>
        <el-form-item label="出生年月" prop='birth'>
          <el-date-picker
            v-model="form.birth"
            type="date"
            placeholder="选择日期"
            value-format="yyyy-MM-dd"
            >
          </el-date-picker>
        </el-form-item>
      </el-col>
      <el-col :span='12'>
        <el-form-item label="政治面貌" prop='face'>
          <el-select v-model="form.face" placeholder="请选择">
            <el-option label="中共党员" value="中共党员"></el-option>
            <el-option label="中共预备党员" value="中共预备党员"></el-option>
            <el-option label="共青团员" value="共青团员"></el-option>
            <el-option label="民主党派" value="民主党派"></el-option>
            <el-option label="群众" value="群众"></el-option>
            <el-option label="其他" value="其他"></el-option>
          </el-select>
          <!-- <el-input v-model="form.face"></el-input> -->
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span='12'>
        <el-form-item label="毕业院校" prop='school'>
          <el-input v-model="form.school"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span='12'>
        <el-form-item label="联系手机" prop='tel'>
          <el-input v-model.number="form.tel" :disabled="true"></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <!-- <el-col :span='24'>
        <el-form-item label="身份证" prop='idCard'>
          <el-input v-model="form.idCard"></el-input>
        </el-form-item>
      </el-col> -->
      <!-- <el-col :span='12'>
        <el-form-item label="项目名称">
          <el-input v-model="form.projectName"></el-input>
        </el-form-item>
      </el-col> -->
      <!-- <el-col :span='12'>
        <el-form-item label="电子邮箱">
          <el-input v-model="form.email"></el-input>
        </el-form-item>
      </el-col> -->
      <!-- <el-col :span='24'>
        <el-form-item label="紧急联系人姓名及电话">
          <el-input v-model="form.namePhone"></el-input>
        </el-form-item>
      </el-col>       -->
      <!-- <el-col :span='24'>
        <el-form-item label="个人履历（非必填）">
          <el-input type="textarea" :rows="4" v-model="form.intro"></el-input>
        </el-form-item>
      </el-col> -->
      <!-- <el-col :span='24'>
        <el-form-item label="项目名称">
          <el-input v-model="form.projectName"></el-input>
        </el-form-item>
      </el-col> -->
    </el-row>
    <el-row :gutter="20">
      <el-col :span='12'>
        <el-form-item label="项目名称" prop='projectName'>
          <el-input v-model="form.projectName"></el-input>
        </el-form-item>
      </el-col>
      <!-- <el-col :span='8'>
        <el-form-item label="团队人数">
          <el-input v-model="form.projectNum"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span='8'>
        <el-form-item label="申请">
          <el-input v-model="form.request"></el-input>
        </el-form-item>
      </el-col> -->
      <el-col :span='12'>
        <el-form-item label="获得全国性大赛奖励" prop='price'>
          <el-radio-group v-model="form.price">
            <el-radio label="是">是</el-radio>
            <el-radio label='否'>否</el-radio>
          </el-radio-group>
          <!-- <el-input v-model="form.price"></el-input> -->
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span='12'>
        <el-form-item label="成立公司情况" prop='ifHaveCompany'>
          <el-radio-group v-model="form.ifHaveCompany">
            <el-radio label="已成立过">已成立过</el-radio>
            <el-radio label='未成立过'>未成立过</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-col>
      <el-col :span='12'>
        <el-form-item label="人才公寓需求数量" prop='apartmentNum'>
          <el-input :min='0' v-model.number="form.apartmentNum" placeholder="请输入数字"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span='24'>
        <el-form-item  v-if="form.ifHaveCompany === '已成立过'" label="已成立公司名称" prop='theCompanyName'>
          <el-input v-model="form.theCompanyName"></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
       <el-form-item label="团队成员"></el-form-item>
    </el-row>
    <el-table :data="teamList" border style="width: 100%">
      <el-table-column prop="teamName" label="姓名" width="180">
         <template slot-scope="scope">
            <el-input
              placeholder="请输入姓名"
              v-model="scope.row.teamName"
              clearable
            />
          </template>
      </el-table-column>
      <el-table-column prop="teamSex" label="性别" width="130">
        <template slot-scope="scope">
         <el-radio-group v-model="scope.row.teamSex">
            <el-radio label="男">男</el-radio>
            <el-radio label='女'>女</el-radio>
          </el-radio-group>
        </template>
      </el-table-column>
      <el-table-column prop="addteamIdCardress" label="证件号码（身份证、台胞证）">
        <template slot-scope="scope">
          <el-input
            placeholder="请输入证件号码"
            v-model="scope.row.teamIdCard"
            clearable
          />
        </template>
      </el-table-column>
       <el-table-column prop="teamPhone" label="手机号" width="180">
         <template slot-scope="scope">
          <el-input
            placeholder="请输入手机号"
            v-model="scope.row.teamPhone"
            clearable
          />
        </template>
      </el-table-column>
      <el-table-column label="操作" width="100">
        <template slot-scope="scope">
          <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
      <el-row :gutter="20" style="margin-top: 10px">
        <el-col :span='11' :offset="11">
          <el-button type='primary' size='mini' @click="addItem">增加成员</el-button>
        </el-col>
      </el-row>         
      <el-row :gutter="20">
        <el-col :span='24'>
          <el-form-item label="项目简介" prop='projectIntro'>
            <el-input placeholder="不超过两百字" type="textarea" :rows="4" v-model="form.projectIntro"></el-input>
          </el-form-item>
        </el-col>
        
      <!-- <el-col :span='24'>
        <el-form-item label="获奖情况">
          <el-input type="textarea" :rows="4" v-model="form.price"></el-input>
        </el-form-item>
      </el-col> -->
      
      <el-col :span='24'>
        <el-form-item label="项目负责人签字（本人承诺所填写内容的真实性，合法性，并愿意为此承担一切法律责任）">
          <el-col :span='12' v-show='!ifMobile'>
            <el-popover
              placement="bottom"
              trigger="click">
              <foot-market :type='1' @update='updateSignNUm'></foot-market>
              <el-button slot="reference" class="signBtn" type="primary" plain>手机扫码添加签名</el-button>
            </el-popover>
          </el-col>
          <el-col :span='12' v-show='ifMobile'>
            <canvas id="signatureCanvas" width='420px' style="backgroundColor: #fff;"></canvas>
            <span style="color: red">（签名区）</span>
            <!-- <div>
              <el-button size="mini" @click="clearSignature">清除</el-button>
              <el-button size="mini" type="primary" @click="saveSignature">保存</el-button>
            </div>             -->
          </el-col>
          
          <el-col :span='4'> 
             <el-button type="primary" v-show='!ifMobile' plain @click="getSignStore">更新签名</el-button>
          </el-col>   
          <!-- <el-col :span='8'>
            <el-date-picker value-format="yyyy-MM-dd" v-model="form.dateProjectLeader" type="date" placeholder="选择签署日期" ></el-date-picker>
          </el-col>     -->
          <el-col :span='12' v-show='ifMobile'>
            <!-- <canvas id="signatureCanvas" width='420px' style="backgroundColor: #fff;"></canvas> -->
            <div>
              <el-button size="mini" @click="clearSignature">清除</el-button>
              <el-button size="mini" type="primary" @click="saveSignature">保存</el-button>
            </div>            
          </el-col>   
        </el-form-item>
      </el-col>
      <el-col v-show="form.signProjectLeader" :span='24' >
         <el-image style="width: 100px; height: 100px" :src="form.signProjectLeader"></el-image>
         <el-button type="danger" icon="el-icon-delete" circle @click="form.signProjectLeader = ''"></el-button>
      </el-col>
     </el-row>
    <!-- <el-table :data="teamList" border style="width: 100%">
      <el-table-column prop="teamName" label="姓名" width="180">
      </el-table-column>
      <el-table-column prop="teamSex" label="性别" width="180">
      </el-table-column>
      <el-table-column prop="addteamIdCardress" label="身份证">
      </el-table-column>
    </el-table> -->
     <el-row :gutter="20" style="border: 1px solid #cecdcd; ">
        <el-col :span='24'  style="border-bottom: 1px solid #cecdcd;" class="letterHight">
          <el-form-item prop='fileIdCard'  label="附件1：身份证正反面" label-width="365px" style="margin-bottom: 0" :required="true">            
            <el-upload
              class="upload-demo upload-demo-larger2"
              multiple
              :action='actionUrl'
              :file-list="form.fileIdCard"
              :on-success="handleChange1"
              :on-remove="handleChange1_1"
              accept=".jpg,.png,.pdf"
              >
             <el-button size="small" type="primary">点击上传</el-button>
               <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div> -->
            </el-upload>
            <template slot="label">
              附件1：身份证 <br>
              <span style="color: red;">提醒：上传身份证原件正反面照片，清晰完整，在有效期内</span>              
            </template>
          </el-form-item>
        </el-col>
        <el-col :span='24' style="border-bottom: 1px solid #cecdcd" class="letterHight">
          <el-form-item label="附件2：学历学位证书" label-width="365px" style="margin-bottom: 0" :required="true">  
            <el-upload
              class="upload-demo"
              :action='actionUrl'
              multiple
              :file-list="form.fileDegree"
              :on-success="handleChange2"
              :on-remove="handleChange2_1"
              accept=".jpg,.png,.pdf"
              >
              <el-button size="small" type="primary">点击上传</el-button>
            </el-upload>
            <template slot="label">
              附件2：学历学位证书 <br>
              <span style="color: red;">提醒：上传全日制本科及以上学历学位证明</span>
            </template>
          </el-form-item>
        </el-col>
        <el-col :span='24'  style="border-bottom: 1px solid #cecdcd">
          <el-form-item label="附件3：创业计划书" label-width="365px" style="margin-bottom: 0" :required="true">  
            <el-upload
              class="upload-demo"
              :action='actionUrl'
              multiple
              :file-list="form.filePlan"
              :on-success="handleChange3"
              :on-remove="handleChange3_1"
              accept=".doc,.docx,.pdf"
              >
              <el-button size="small" type="primary">点击上传</el-button>
            </el-upload>
            <template slot="label">
              附件3：创业计划书 
            </template>
          </el-form-item>
        </el-col>
         <el-col :span='24'  style="border-bottom: 1px solid #cecdcd" class="letterHight">
          <el-form-item label="附件4：资金计划表" label-width="365px" style="margin-bottom: 0" :required="true">  
            <el-upload
              class="upload-demo upload-demo-larger"
              :action='actionUrl'
              multiple
              :file-list="form.fileFunds"
              :on-success="handleChange4"
              :on-remove="handleChange4_1"
              accept=".doc,.docx,.xls,.xlsx,.pdf"
              >
              <el-button size="small" type="primary">点击上传</el-button>
            </el-upload>
            <template slot="label">
              附件4：资金计划表 
              <a href="/profile/upload/资金使用计划表.xlsx">示例表（点击下载）</a><br>
              <span style="color: red;">
              提醒：资金计划表只针对获得资助资金的使用计划（50万元、30万元、20万元、5万元），资助资金专用于创业项目公司保障项目开展、公司经营、日常办公所需的支出，不得用于职工福利发放、业务招待等非经营性支出
              </span>
            </template>
          </el-form-item>
        </el-col>
        <!-- <el-col :span='24' style="border-bottom: 1px solid #cecdcd">
          <el-form-item>
            提醒：针对所获的资助资金的使用计划，专用于创业项目公司保障项目开展、公司经营、日常办公所需的支出，不得用于职工福利发放、业务招待等非经营性支出；
          </el-form-item>
        </el-col> -->
         <!-- <el-col :span='24'  style="border-bottom: 1px solid #cecdcd">
          <el-form-item label="附件5：近5年社保缴费记录" label-width="200px" style="margin-bottom: 0" :required="true">  
            <el-upload
              class="upload-demo"
              :action='actionUrl'
              multiple
              :limit="2"
              :file-list="form.fileSocial"
              :on-change="handleChange5"
              :on-remove="handleChange5"
              >
              <el-button size="small" type="primary">点击上传</el-button>
            </el-upload>
          </el-form-item>
        </el-col>-->
         
        <el-col :span='24'   style="border-bottom: 1px solid #cecdcd" class="letterHight">
          <el-form-item label="附件5：近5年个税缴纳记录" label-width="365px" style="margin-bottom: 0" :required="true">  
            <el-upload
              class="upload-demo upload-demo-larger"
              :action='actionUrl'
              multiple
              :file-list="form.fileIncome"
              :on-success="handleChange6"
              :on-remove="handleChange6_1"
              accept=".pdf"
              >
              <el-button size="small" type="primary">点击上传</el-button>
            </el-upload>
            <template slot="label">
              附件5：个税记录 <br>
              <span style="color: red;">
              提醒：打开个人所得税APP，点击纳税记录开具，开具选择2019-01到至今，生成纳税记录，纳税记录最多可选取三年，可分两个时间段生成，如未有缴纳记录显示无需制作，请将纳税记录申请记录截图上传
              </span>
            </template>
          </el-form-item>
        </el-col>
        <el-col :span='24'   style="border-bottom: 1px solid #cecdcd" class="letterHight">
          <el-form-item label="附件6：新注册公司股东信息" label-width="365px" style="margin-bottom: 0" :required="true">  
            <el-upload
              class="upload-demo "
              :action='actionUrl'
              multiple
              :file-list="form.fileShareholders"
              :on-success="handleChange8"
              :on-remove="handleChange8_1"
              accept=".doc,.docx,.xls,.xlsx,.pdf"
              >
              <el-button size="small" type="primary">点击上传</el-button>
            </el-upload>
            <template slot="label">
              附件6：新注册公司股东信息
              <a href="/profile/upload/新注册公司股东信息.xlsx">示例表（点击下载）</a> <br>
              <span style="color: red;">
                提醒：申请人必须为新公司注册控股股东
              </span>
              <!-- <div @click="downloadUrl">下载</div> -->
            </template>
          </el-form-item>
        </el-col>
        <el-col :span='24' class="letterHight">
          <el-form-item label="附件6：全国性大赛奖励证书" label-width="365px" style="margin-bottom: 0">  
            <el-upload
              class="upload-demo upload-demo-large"
              :action='actionUrl'
              multiple
              :file-list="form.fileOthers"
              :on-success="handleChange7"
              :on-remove="handleChange7_1"
              accept=".pdf"
              >
              <el-button size="small" type="primary">点击上传</el-button>
            </el-upload>
            <template slot="label">
              附件7：全国性大赛奖励证书 <br>
              <span style="color: red;">
              提醒：如有多个证书整合至同一个pdf中上传
              </span>
            </template>
          </el-form-item>
        </el-col>
      </el-row>  

      <div style="display:flex; justify-content: center; align-item: center; margin-top: 20px;" v-if='!ifDisabled'>       
        <el-checkbox v-model="ifAgree" :disabled="delTime != 0"></el-checkbox>
        <div class="agreeBtn"  @click="agreement"> 承诺书（点击查看,五秒后可同意）</div>
      </div>
       <div class='btns' v-if='!ifDisabled'>
          <!-- <el-button v-if="form.status == 0 || form.status == -1" type="default" @click="onNext">临时保存</el-button> -->
          <!-- <el-button v-if="form.status == -1" type="default" @click="onNext">更新</el-button> -->
          <el-button v-if="form.status == 0 || form.status == -1" type="primary" @click="beforSubmit">立即申请</el-button>     
      </div>
  </el-form>
 </div>
  
 </div>
</template>

<script>
import {
  Host_Ip2
} from "../../config.js"
// import SignaturePad from 'signature_pad'
import FootMarket from './components/FootMarket.vue'
import {registerSubmit, loginForm, getSms, GetFormLastTime, SetImgFiles, SubmitForm, SubmitForm2, GetImgTempTime } from '../../api/requestForm.js'
import Verify from '@/components/verifition/Verify'

// import QRCode from 'qrcodejs2'
export default {
  components: {
    FootMarket,
    Verify
  },
  data () {
    return {
      dateTime: '',
      Verify: '',
      form: {
        name: '',
        sex: '男',
        region: '',
        education: '',
        birth: null,
        face: '',
        school: '',
        tel: null,
        idCard: '',
        namePhone: '',
        email: '',
        intro: '',
        projectName: '',
        projectNum: '',
        request: '',
        bigPro: '',
        applyParkTeamList: [],
        projectIntro: '',
        price: '否',
        ifHaveCompany: '未成立过',
        apartmentNum: '',
        theCompanyName: '',
        signProjectLeader: '',
        location: '',
        area: 0,
        signInvest: '',
        dateInvest: null,
        signManager: '',
        dateManager: null,
        signParkLeader: '',
        dateParkLeader: null,
        fileIdCard: [],
        fileDegree: [],
        filePlan: [],
        fileFunds: [],
        fileSocial: [],
        fileIncome: [],
        fileShareholders: [],
        fileOthers: [],
        filePhoto: [],
        status: 0,
        signPromise: '',
      },
      form2: {},
      rules2: {
        password: [
          { required: true, message: '请输入密码', trigger: 'blur' },
          { min: 6, message: '密码至少六位', trigger: 'blur' }
        ],
        mobile: [
          { required: true, message: '此项必填', trigger: 'blur' },
          { min: 11, max: 11, message: '请输入11位手机号', trigger: 'blur' },
        ],
        username: [
          { required: true, message: '此项必填', trigger: 'blur' },
        ],
        password2: [
          { required: true, message: '请输入密码', trigger: 'blur' },
          {
            validator: (rules2, value, callback) => {
                if (value !== this.form2.password) callback(new Error('两次密码不一致'))
                callback()
            }, trigger: 'blur'
          }
        ],
        captcha: [
          { required: true, message: '请输入验证码', trigger: 'blur' },
        ],
      },
      loging: true,
      activeTab: "tab1",
      hasHis: false,
      historyList: [
        {
          name: '审批不通过',
          status: -2,
        },
        {
          name: '退回修改',
          status: -1,
        },
        {
          name: '园区负责人审批',
          status: 3,
        },
        {
          name: '审批通过',
          status: 4,
        },
      ],
      actionUrl: Host_Ip2 + '/dfs/upload',
      thisStatus: true,
      randomNum: '',
      randomNum2: '',
      teamList: [
        {
          teamName: null,
          teamSex: null,
          teamIdCard: null,
          teamPhone: null,
          teamAct: null,
        },
        {
          teamName: null,
          teamSex: null,
          teamIdCard: null,
          teamPhone: null,
          teamAct: null,
        }
      ],
      rules: {
        name: [
          { required: true, message: '请输入姓名', trigger: 'blur' },
        ],
        sex: [
          { required: true, message: '请选择性别', trigger: 'blur' },
        ],
        education: [
          { required: true, message: '请选择最高学历', trigger: 'blur' },
        ],
        birth: [
          { required: true, message: '请选择出生年月', trigger: 'blur' },
        ],
        face: [
          { required: true, message: '请选择政治面貌', trigger: 'blur' },
        ],
         school: [
          { required: true, message: '请输入毕业院校', trigger: 'blur' },
        ],
         tel: [
          { required: true, message: '请输入联系电话', trigger: 'blur' },
          { 
            // pattern: /^(13[^4]|14[579]|15[^4\D]|16[6]|17[^49\D]|18\d|19[89])\d{8}$/,
            pattern: /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/,
            message: '请输入正确联系电话', trigger: 'blur' 
          }
        ],
         projectName: [
          { required: true, message: '请输入项目名称', trigger: 'blur' },
        ],
        price: [
          { required: true, message: '请选择获得全国性大赛奖励', trigger: 'blur' },
        ],
        apartmentNum: [
          { required: true, message: '请输入人才公寓需求数量', trigger: 'blur' },
          { type: 'number', message: '人才公寓需求数量为数字值'}
          
        ],
        theCompanyName: [
          { required: true, message: '请输入已成立公司名称', trigger: 'blur' },
        ],
         projectIntro: [
          { required: true, message: '请输入项目简介', trigger: 'blur' },
          { max: 200, message: '不要超过200个字', trigger: 'blur' },
        ],

         idCard: [
            { required: true, message: '请输入证件号码', trigger: 'blur' },
            // { 
            //   pattern:/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
            //   message: '请输入正确身份证号', trigger: 'blur' 
            // }
          ],
      },
      ifDisabled: false,
      dialogFormVisible: false,
      dialogFormVisible2: false,
      dialogFormVisible3: false,
      checked1: false,
      checked2: false,
      checked3: false,
      checked4: false,
      ifAgree: false,
      delTime: 5,
      ifMobile: false,
      hiddenImg: false,
      codeDel: 60,
      codeMsg: '获取验证码',
      popVisible: false,
    }
  },
  methods: {    
  download() {
    let url = 'https://files.jlzx.jspc.org.cn/Uploads/KJFZ/2024-02-24/20240224044742a9fc8612-9ac4-42ad-aafc-3bf75a785738/%E9%83%91%E6%B5%8B%E8%AF%95-%E7%94%B3%E6%8A%A5%E4%B9%A6.pdf'
    let name = '实例.pdf'
    // 发送http请求，将文件链接转换成文件流
    let xhr = new XMLHttpRequest()
    xhr.open('get', url, true)
    // 请求类型
    xhr.responseType = 'blob'
    xhr.onreadystatechange = function() {
      // 获取接口结果
        if (xhr.readyState === 4 && xhr.status === 200) {
          window.URL = window.URL || window.webkitURL
          let a = document.createElement('a')
          let blob = new Blob([xhr.response])
          // 通过二进制文件创建url
          let url = window.URL.createObjectURL(blob)
          a.href = url
          a.download = name
          a.click()
          // 销毁创建的url
          window.URL.revokeObjectURL(url)
        }
    }
    xhr.send()

  },
  downloadUrl() {
    window.open('http://tcdcy.tcgxqyzs.com/profile/upload/新注册公司股东信息.xlsx', '_self')
  },
    // 图形验证
    capctchaCheckSucc (data) {
      this.capctchaCheck = true
      this.verify = data.captchaVerification
      // MEMBER_LOGIN MEMBER_REGISTER
      let sms = this.loging ? 'MEMBER_LOGIN' : 'MEMBER_REGISTER'
      this.getIdCode(sms)
    },
    // 获取验证码
    getIdCode(code) {
      if (!this.capctchaCheck) {
        this.$refs.verify.show()
        return false
      }
      // 验证码倒计时60s
      let that = this
      let form = {
        mobile: this.form2.mobile,
        smsType: code,
      }
      form = JSON.parse(JSON.stringify(form))
      console.log(form, 'code')
      getSms(form).then(res => {
        if(res.data.code == 0) {  
          console.log(res, 'getSms')
          function changeCodeDel() {
            if(that.codeDel > 0) {        
              that.codeDel --
              that.codeMsg = '已发送' + that.codeDel + 's'
              // console.log(that.codeDel)
            } else {
              that.codeDel = 60;
              that.codeMsg = '获取验证码'
              clearInterval(Interval)
              that.capctchaCheck = false
            }
          }
          let Interval = setInterval(() => {
            changeCodeDel()
          }, 1000)
        } else {
          this.$message({
            message: res.data.msg,
            type: 'error',
            duration: 3000
          })
          this.$refs.verify.refresh()
        }
      })
      // 增加倒计时不可点击
    },
    // 登录
    toLoging() {
      // this.hasHis = true;
      this.$refs['form2'].validate((valid) => {
        let that = this;
          if (valid) {
            const form = JSON.parse(JSON.stringify(that.form2))
            console.log(form, 'login')
            loginForm(form).then(res => {
              console.log(res)
              if(res.data.code == 0) {          
                that.dialogFormVisible3 = false;
                this.$message({
                  message: '登录成功',
                  type: 'success',
                  duration: 3000
                })
                // 暂存token 手机号
                localStorage.setItem('token', res.data.token)
                localStorage.setItem('tel', res.data.mobile)
                // localStorage.setItem(
                //   {
                //     value: res.data.token,
                //     name: 'token',
                //     expires: 86400000
                //   }
                // )
                // localStorage.setItem(
                //   {
                //     value: res.data.mobile,
                //     name: 'tel',
                //     expires: 86400000
                //   }
                // )
                // that.$store.commit('changetoken', res.data.token)
                // that.$store.commit('changetel', res.data.mobile)
                // console.log(that.$store.state, '??')
                // 绑定手机号
                that.form.tel = res.data.mobile
                // 历史数据赋值
                that.getLAstForm()                
              } else {
                this.$message({
                  message: res.data.msg,
                  type: 'error',
                  duration: 3000
                })
                // this.$refs.verify.refresh()
              }
            })
          } else {
            console.log('error submit!!');
            return false;
          }
        });     
    },
    // 登出
    loginOut() {
      this.popVisible = false;
      delete localStorage.token
      delete localStorage.tel
      location.reload()
    },
    // 注册
    toRegister() {
      this.$refs['form2'].validate((valid) => {
        let that = this;
          if (valid) {             
            const form = JSON.parse(JSON.stringify(that.form2))
            console.log(form, 'register')
            registerSubmit(form).then(res => {
              console.log(res)
              if(res.data.code == 0) {          
                that.dialogFormVisible3 = false;
                this.$message({
                  message: '注册成功，已登录',
                  type: 'success',
                  duration: 3000
                })
                localStorage.setItem('token', res.data.token)
                localStorage.setItem('tel', res.data.mobile)
                // localStorage.setItem(
                //   {
                //     value: res.data.token,
                //     name: 'token',
                //     expires: 86400000
                //   }
                // )
                // localStorage.setItem(
                //   {
                //     value: res.data.mobile,
                //     name: 'tel',
                //     expires: 86400000
                //   }
                // )
                that.form.tel = res.data.mobile
                that.loging = true
                that.form2 = {};
                // location.reload();
              } else {
                this.$message({
                  message: res.data.msg,
                  type: 'error',
                  duration: 3000
                })
              }
            })
          } else {
            console.log('error submit!!');
            return false;
          }
        });      
    },
    // 切换登录注册状态
    changeLogin(flag) {
      this.loging = flag;
      this.form2 = {};
    },
    // 查看
    detail(row) {
      console.log(row, 'detail');
      // this.hasHis = false
      this.ifDisabled = !(row.status == -1);
      this.form = row;        
      this.form.fileIdCard = JSON.parse(row.fileIdCard)
      this.form.fileDegree = JSON.parse(row.fileDegree)
      this.form.filePlan = JSON.parse(row.filePlan)
      this.form.fileFunds = JSON.parse(row.fileFunds)
      this.form.fileOthers = JSON.parse(row.fileOthers)
      this.form.fileSocial = JSON.parse(row.fileSocial)
      this.form.fileIncome = JSON.parse(row.fileIncome)
      this.form.fileShareholders = JSON.parse(row.fileShareholders)
      // this.form.filePhoto = row.filePhoto
      this.form.tel = Number(row.tel)
      this.form.apartmentNum = Number(row.apartmentNum)
      this.teamList = row.applyParkTeamList
      console.log(this.form, 'this.form')   
      
    },
    // 二维码是否隐藏
    ifHidden(flag) {
      this.hiddenImg = flag;
      let imgLeft = document.getElementsByClassName('flyCode')[0]
      if(flag) {
        imgLeft.style.left = '-150px'
      } else {
         imgLeft.style.left = '50px'
      }
    },
    initSignaturePad() {
      const signaturePad = new SignaturePad(document.getElementById('signatureCanvas'), {
        // 可选参数配置，具体可参考signature_pad文档
      });
      this.signaturePad = signaturePad;
    },
    clearSignature() {
      this.signaturePad.clear();
      this.form.signProjectLeader = ''
    },
    saveSignature() {
      let imgfile = this.signaturePad.toDataURL();
      // 在这里可以对签名进行进一步处理或保存到服务器等操作
      console.log(imgfile);

      // 返回blob文件对象
      const dataURLtoFile = (dataurl, filename) => {
        const arr = dataurl.split(',');
        const mime = arr[0].match(/:(.*?);/)[1];
        const bstr = atob(arr[1]);
        let n = bstr.length;
        const u8arr = new Uint8Array(n);
        while (n--) {
          u8arr[n] = bstr.charCodeAt(n);
        }
        return new Blob([u8arr], { type: mime });
      };
      
      const filename = `${new Date().getTime()}img.png`;
      imgfile = dataURLtoFile(imgfile, filename);
      let formData = new FormData();
      formData.set('file', imgfile)
      const that = this
      SetImgFiles(formData, that.randomNum).then((res) => {
        console.log('submit', res)
        if(res.data.url) {
          // 跳转页面/弹窗全部遮盖不关闭 提示web点击获取签名
          this.form.signProjectLeader = res.data.data;
        //  document.getElementById("topScreen").style.display = "flex";
        }
      })
    },
    backtoIndex() {
      this.$router.push({ path: '/solution' })
    },
    // 提示弹窗
    ifAllAgree() {
      if(!this.checked1 || !this.checked2 || !this.checked3 || !this.checked4) {
        this.dialogFormVisible = true
        this.$message.error('全部同意后才可填报');
      } else {
        this.dialogFormVisible = false
      }
    },
    // 是否同意承诺书
    ifAgreeAgreement(flag) {
      if(flag && !this.form.signPromise) {
        this.$alert('请先签名！ 若已签，请点击签名更新按钮！', '提示', {
          //  confirmButtonText: '确定',
          type: 'warning',
          center: true,
          callback: action => {}
         })
         return
      }
      this.ifAgree = flag;
      this.delTime = 5;
      this.dialogFormVisible2 = false
    },
    beforeAvatarUpload(file) {
      // const isJPG = file.type === 'image/jpeg';
      const isLt2M = file.size / 1024 / 1024 < 1;

      // if (!isJPG) {
      //   this.$message.error('上传头像图片只能是 JPG 格式!');
      // }
      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!');
      }
      return isLt2M;
    },
    // 查看承诺书
    agreement() {
      console.log(123)      
      this.dialogFormVisible2 = true
      // ifAgree
      // 弹窗打开倒计时 展示倒计时 
      const del = setInterval(toDel, 1000)
      // 未满五秒不可点击同意
      const that = this
      function toDel () {
        console.log(that.delTime)
         if(that.delTime <= 0) {
          clearInterval(del)
        } else {
          that.delTime--;
        }
      }
    },
    // 提交表单前
    beforSubmit() { 
      // console.log(this.form, '1111')
      if(!this.form.fileIdCard.length) {
        this.$alert('请上传附件1：身份证', '提示', {
          //  confirmButtonText: '确定',
          type: 'warning',
          center: true,
          callback: action => {}
         })
        return
      }
      if(!this.form.fileDegree.length) {
        this.$alert('请上传附件2：学历学位证书', '提示', {
          //  confirmButtonText: '确定',
          type: 'warning',
          center: true,
          callback: action => {}
         })
        return
      }
      if(!this.form.filePlan.length) {
        this.$alert('请上传附件3：创业计划书', '提示', {
          //  confirmButtonText: '确定',
          type: 'warning',
          center: true,
          callback: action => {}
         })
        return
      }
      if(!this.form.fileFunds.length) {
        this.$alert('请上传附件4：资金计划表', '提示', {
          //  confirmButtonText: '确定',
          type: 'warning',
          center: true,
          callback: action => {}
         })
        return
      }
      // if(!this.form.fileSocial.length) {
      //   this.$alert('请上传附件5：近5年社保缴费记录', '提示', {
      //     //  confirmButtonText: '确定',
      //     type: 'warning',
      //     center: true,
      //     callback: action => {}
      //    })
      //   return
      // }
      if(!this.form.fileIncome.length) {
        this.$alert('请上传附件5：个税记录', '提示', {
          //  confirmButtonText: '确定',
          type: 'warning',
          center: true,
          callback: action => {}
         })
        return
      }
      if(!this.form.fileShareholders.length) {
        this.$alert('请上传附件6：新注册公司股东信息', '提示', {
          //  confirmButtonText: '确定',
          type: 'warning',
          center: true,
          callback: action => {}
         })
        return
      }
      if(!this.form.filePhoto.length) {
        this.$alert('请上传免冠照片', '提示', {
          //  confirmButtonText: '确定',
          type: 'warning',
          center: true,
          callback: action => {}
         })
        return
      }
    // 清空成员为空的内容
      const obj = {
        teamName: null,
        teamSex: null,
        teamIdCard: null,
        teamPhone: null,
        teamAct: null,
      };
      let len = this.teamList.length;
      const reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
      for(let i = 0; i < len; i++) {
        // console.log(i, this.teamList[i], JSON.stringify(this.teamList[i]) == JSON.stringify(obj))
        if(JSON.stringify(this.teamList[i]) == JSON.stringify(obj)) {
          this.teamList.splice(i, 1)
          i--;
        }
      }
      // let len2 = this.teamList.length;
      // for(let i = 0; i < len2; i++) {
      //   if(!reg.test(this.teamList[i].teamIdCard)) {
      //       this.$message.error('成员身份证有误');
      //       return
      //     }
      // }
      // console.log(this.teamList, 'this.teamList')
    
      this.$refs['form'].validate((valid) => {
        if (valid) {
          console.log('submit!');
          // return
          this.onSubmit()
        } else {
          console.log('error submit!!');
          this.$alert('表单填报内容有误', '提示', {
            type: 'warning',
            center: true,
            callback: action => {}
          })
          return false;
        }
      });      
    },
    // 清空表单
    clearForm() {
      location.reload()
    },
    // 提交表单
    onSubmit() {      
      // // 成员为空的内容
      // 校验
      if(!this.form.signProjectLeader) {
        const alertTxt = '请签名！ 若已签，请点击签名更新按钮！'
        if(this.ifMobile) {
          alertTxt = '请签名！ 若已签，请点击签名保存按钮！'
        }
        this.$alert(alertTxt, '提示', {
          //  confirmButtonText: '确定',
          type: 'warning',
          center: true,
          callback: action => {}
         })
        return
      }
      if(!this.ifAgree) {
         this.$alert('请同意承诺书！', '提示', {
          //  confirmButtonText: '确定',
          type: 'warning',
          center: true,
          callback: action => {}
         })
        return
      }
      const form = JSON.parse(JSON.stringify(this.form))
      form.fileIdCard = form.fileIdCard.length ? JSON.stringify(form.fileIdCard) : '[]'
      form.fileDegree = form.fileDegree.length ? JSON.stringify(form.fileDegree) : '[]'
      form.filePlan =  form.filePlan.length ? JSON.stringify(form.filePlan) : '[]'
      form.fileFunds =  form.fileFunds.length ? JSON.stringify(form.fileFunds) : '[]'
      form.fileSocial =  form.fileSocial.length ? JSON.stringify(form.fileSocial) : '[]'
      form.fileIncome =  form.fileIncome.length ? JSON.stringify(form.fileIncome) : '[]'
      form.fileShareholders =  form.fileShareholders.length ? JSON.stringify(form.fileShareholders) : '[]'
      form.fileOthers =  form.fileOthers.length ? JSON.stringify(form.fileOthers) : '[]'
      // form.filePhoto =  form.filePhoto.length ? form.filePhoto[0].response.url : '[]'
      if(form.filePhoto.length) {
        if(form.filePhoto[0].response)
          form.filePhoto = form.filePhoto[0].response.url
        else
          form.filePhoto = form.filePhoto
      } else {
        form.filePhoto = '[]'
      }
     
      form.applyParkTeamList = this.teamList
      // console.log(form.fileIdCard, 'form.fileIdCard ')
      if(this.form.ifHaveCompany !== '已成立过') {
        form.theCompanyName = '无'
      }
      let params = JSON.stringify(form)
      // console.log(form, params, '1111')
      // return
      if(form.status == -1) {
        SubmitForm2(params).then((res) => {
          console.log('submit', res)
          if(res.data.code == 0) {
            this.$message({
              message: '提交成功',
              type: 'success',
              duration: 3000
            })
            this.clearForm()
          } else {           
            this.$message({
              message: res.data.msg,
              type: 'error',
              duration: 3000
            })
             if(res.data.msg == '身份验证失败') {
              this.loginOut()
            }
          }
          
        })
      } else {
          SubmitForm(params).then((res) => {
          if(res.data.code == 0) {
            this.$message({
              message: '提交成功',
              type: 'success',
              duration: 3000
            })
            this.clearForm()
          } else {
            this.$message({
              message: res.data.msg,
              type: 'error',
              duration: 3000
            })
             if(res.data.msg == '身份验证失败') {
              this.loginOut()
            }
          }
        })
      }
    },
    // 暂存表单
    // onNext() {
    //   const form = JSON.parse(JSON.stringify(this.form))
    //   form.fileIdCard = form.fileIdCard.length ? JSON.stringify(form.fileIdCard) : ''
    //   form.fileDegree = form.fileDegree.length ? JSON.stringify(form.fileDegree) : ''
    //   form.filePlan = form.filePlan.length ? JSON.stringify(form.filePlan) : ''
    //   form.fileFunds = form.fileFunds.length ? JSON.stringify(form.fileFunds) : ''
    //   form.fileOthers = form.fileOthers.length ? JSON.stringify(form.fileOthers) : ''
    //   let params = JSON.stringify(form)
    //   console.log(form, params, '22222')
    //   SaveFormLastTime(params).then((res) => {
    //     console.log('submit', res)
    //   })
    // },
    // 获取上次填报内容
    getLAstForm() {
      let that = this;
      if(localStorage.getItem('token') && localStorage.getItem('tel')) {
        that.dialogFormVisible3 = false;
        // 绑定手机号
        that.form.tel = localStorage.getItem('tel')
        GetFormLastTime().then(res => {  
          console.log(res, res.data.data == null,'mine')
          if(res.data.code == 0  && res.data.data != null) {  
            console.log(res, res.data.data.name, res.data.data.status,'上次填报内容')
            this.hasHis = true
            this.historyList = []
            this.historyList.push(res.data.data)
            this.historyList[0].name2 = res.data.data.name
            this.detail(res.data.data)
          } else if(res.data.code != 0) {
            if(res.data.msg == '身份验证失败') {
              this.loginOut()
            }
            this.$message({
              message: res.data.msg,
              type: 'error',
              duration: 3000
            })
          }
        })
      } else {
        this.dialogFormVisible3 = true
      }    
      
    },
    // 附件修改
    handleChange1(response, file, fileList) {
      console.log(response, 'response')
      if(response.code !== 0) {
        this.$alert(response.msg, '提示', {
          type: 'warning',
          center: true,
          callback: action => {}
         })
         this.form.fileIdCard = []
      } else {
        this.form.fileIdCard = fileList.slice(-3);     
      }            
      console.log(this.form.fileIdCard, fileList, 'form.fileIdCard')
    },
    handleChange1_1(file, fileList) {
      this.form.fileIdCard = fileList.slice(-3);        
      console.log(this.form.fileIdCard, fileList, 'form.fileIdCard')
    },
    handleChange2(response, file, fileList) {
      console.log(response, 'response')
      if(response.code !== 0) {
        this.$alert(response.msg, '提示', {
          type: 'warning',
          center: true,
          callback: action => {}
         })
         this.form.fileDegree = []
      } else {
        this.form.fileDegree = fileList.slice(-3);     
      }         
      console.log(this.form.fileDegree, fileList, 'form.fileDegree')
    },    
     handleChange2_1(file, fileList) {
      this.form.fileDegree = fileList.slice(-3);        
      console.log(this.form.fileDegree, fileList, 'form.fileDegree')
    },
    handleChange3(response, file, fileList) { 
      console.log(response, 'response')
      if(response.code !== 0) {
        this.$alert(response.msg, '提示', {
          type: 'warning',
          center: true,
          callback: action => {}
         })
         this.form.filePlan = []
      } else {
        this.form.filePlan = fileList.slice(-3);     
      }      
      console.log(this.form.filePlan, fileList, 'form.filePlan')
    },
    handleChange3_1(file, fileList) {
      this.form.filePlan = fileList.slice(-3);        
      console.log(this.form.filePlan, fileList, 'form.filePlan')
    },
    handleChange4(response, file, fileList) {
      console.log(response, 'response')
      if(response.code !== 0) {
        this.$alert(response.msg, '提示', {
          type: 'warning',
          center: true,
          callback: action => {}
         })
         this.form.fileFunds = []
      } else {
        this.form.fileFunds = fileList.slice(-3);     
      }           
      console.log(this.form.fileFunds, fileList, 'form.fileFunds')
    },
    handleChange4_1(file, fileList) {
      this.form.fileFunds = fileList.slice(-3);        
      console.log(this.form.fileFunds, fileList, 'form.fileFunds')
    },
    handleChange5(response, file, fileList) { 
      console.log(response, 'response')
      if(response.code !== 0) {
        this.$alert(response.msg, '提示', {
          type: 'warning',
          center: true,
          callback: action => {}
         })
         this.form.fileSocial = []
      } else {
        this.form.fileSocial = fileList.slice(-3);     
      }      
      console.log(this.form.fileSocial, fileList, 'form.fileSocial')
    },
    handleChange5_1(file, fileList) {
      this.form.fileSocial = fileList.slice(-3);        
      console.log(this.form.fileSocial, fileList, 'form.fileSocial')
    },
    handleChange6(response, file, fileList) {
      console.log(response, 'response')
      if(response.code !== 0) {
        this.$alert(response.msg, '提示', {
          type: 'warning',
          center: true,
          callback: action => {}
         })
         this.form.fileIncome = []
      } else {
        this.form.fileIncome = fileList.slice(-3);     
      }         
      console.log(this.form.fileIncome, fileList, 'form.fileIncome')
    },
    handleChange6_1(file, fileList) {
      this.form.fileIncome = fileList.slice(-3);        
      console.log(this.form.fileIncome, fileList, 'form.fileIncome')
    },
    handleChange7(response, file, fileList) {
      console.log(response, 'response')
      if(response.code !== 0) {
        this.$alert(response.msg, '提示', {
          type: 'warning',
          center: true,
          callback: action => {}
         })
         this.form.fileOthers = []
      } else {
        this.form.fileOthers = fileList.slice(-3);        
      }      
      console.log(this.form.fileOthers, fileList, 'form.fileOthers')
    },
    handleChange7_1(file, fileList) {
      this.form.fileOthers = fileList.slice(-3);        
      console.log(this.form.fileOthers, fileList, 'form.fileOthers')
    },
    handleChange8(response, file, fileList) {
      console.log(response, 'response')
      if(response.code !== 0) {
        this.$alert(response.msg, '提示', {
          type: 'warning',
          center: true,
          callback: action => {}
         })
         this.form.fileShareholders = []
      } else {
        this.form.fileShareholders = fileList.slice(-3);        
      }           
      console.log(this.form.fileShareholders, fileList, 'form.fileShareholders')
    },
     handleChange8_1(file, fileList) {
      this.form.fileShareholders = fileList.slice(-3);        
      console.log(this.form.fileShareholders, fileList, 'form.fileShareholders')
    },
    handleAvatarSuccess(res, file) {
      // this.form.filePhoto = URL.createObjectURL(file.raw);
      this.form.filePhoto.length = 0;
      this.form.filePhoto.push(file)
       console.log(this.form.filePhoto, file, 'form.filePhoto')
    },
    getSignStore(){
      let num = this.randomNum
      GetImgTempTime(num).then(res => {
        console.log(res, 'resssssss')
        if(!res.data.data) {
          this.$alert('请手机扫码签名！', '提示', {
          //  confirmButtonText: '确定',
          type: 'warning',
          center: true,
          callback: action => {}
         })
        }
         this.form.signProjectLeader = res.data.data;
      })
      console.log(this.randomNum, 'randomNum1')
    },
    // 获取承诺书签名
    getSignStore2(){
      let num = this.randomNum2
      GetImgTempTime(num).then(res => {
        console.log(res, 'resssssss')
        if(!res.data.data) {
          this.$alert('请手机扫码签名！', '提示', {
          //  confirmButtonText: '确定',
          type: 'warning',
          center: true,
          callback: action => {}
         })
        }
         this.form.signPromise = res.data.data;
      })
      console.log(this.randomNum2, 'randomNum1')
    },
    updateSignNUm(num) {
      this.randomNum = num;
      console.log(num, 'num')
    },
    // 承诺书签名
    updateSignNUm2(num) {
      this.randomNum2 = num;
      console.log(num, 'num')
    },
    removeItem(index) {
      console.log(index, index)
      this.teamList.splice(index, 1)
    },
    addItem() {
      const item = {
        teamName: null,
        teamSex: null,
        teamIdCard: null,
        teamPhone: null,
        teamAct: null,
      }
      this.teamList.push(item)
    },
    handleDelete(index, row) {
      console.log(index, row);
      this.removeItem(index)
    },
    isMobile() {
      const userAgent = navigator.userAgent.toLowerCase();
      const mobileKeywords = ['mobile', 'android', 'iphone', 'ipad', 'ipod'];

      for (let i = 0; i < mobileKeywords.length; i++) {
        if (userAgent.indexOf(mobileKeywords[i]) !== -1) {
          this.ifMobile = true;
          this.initSignaturePad();
        }
      }
    }
  },
  created() {
    // console.log(this.form, 'thisForm')  
    
  },
  mounted() {
   // this.isMobile()  
  //  this.$refs.verify.show()
  //  return
   this.getLAstForm();     
  },
  watch: {
    activeTab(newVal, oldVal) {
      // console.log(newVal, oldVal)
      this.form2 = {}
    }
  }
}
</script>

<style scoped  lang="less">
// html,body{
//   padding: 0 !important;
//   margin: 0 !important;
// }
.historyRequest {
  // border: 1px solid red;
  margin-bottom: 10px;
  background-color: #e5edf3;
  padding: 20px;
  box-sizing: border-box;
}
.flyCode {
  position: fixed;
  top: 10vh;
  // transform: translateY(-50%);
  left: 50px;
  img {
    width: 150px;
  }
  z-index: 100; 
  transition: all 0.5s ease;
  button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
  }
}
.bacToIndex {
  // position: absolute;
  // margin: 10px;
      height: 40px;
  position: absolute;
  margin: 10px 30px;
  background-color: #0c3cb6;
  color: #fff;
  font-weight: bold;
  border-radius: 8px;
}
.avatar-uploader.el-upload {
    // border: 1px solid #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 100px;
    height: 100px;
    line-height: 100px;
    text-align: center;
    border: 1px solid #cecdcd;
  }
  .avatar {
    width: 100px;
    height: 100px;
    display: block;
  }
.el-form {
  // background-color: #e2f0e8;
  background-color: #e5edf3;
  padding: 20px;
  position: relative;
  top: -5px;
}
.bigForm {
  // background-color: #cfefdd;
  background-color: #adcde4;
  width: 100%;
  min-width: 900px;
}
#request {
  min-height: 100vh;
  width: 900px;
  // height: 100%;
  // border: 1px solid red;
  // 
  margin: 0 auto;
  // height: 2000px;
  .banner {
    width: 100%;
    height: 250px;
  }
  .title {
    text-align: center;
    color: rgb(0, 132, 255);
    font-size: 24px;
    height: 50px;
    line-height: 50px;
    border-bottom: 1px solid rgb(206, 205, 205);
    margin-bottom: 10px;
    // background-color: #adcde4;    
  }
  .outLoginDiv {
    position: absolute;
    height: 55px;
    width: 700px;
    .outLogin {
      position: absolute;
      right: 0;
      z-index: 5;
      bottom: 0;
    }
  }  
  .requestDetail {
    line-height: 22px;
    background-color: rgb(247, 247, 247);
    padding: 20px;
  }
  .el-radio-group,
  .el-select,
  .el-date-editor,
  .signBtn  {
    width: 100%;
  }
  .btns {
    display: flex;
    justify-content: center;
    padding-top: 30px;
    padding-bottom: 50px;
    // border-top: 1px solid rgb(206, 205, 205);    
  }
  .el-checkbox__label {
    display: inline-grid;
    width:300px;
    white-space: pre-line;
    word-wrap: break-word;
    line-height: 20px;    
  }
  .agreeBtn {
    color: red;
    cursor: pointer;
  }
}
.upload-demo {
  display: flex;
  
}

</style>
<style >
html,body{
  padding: 0 !important;
  margin: 0 !important;
}
.upload-demo .el-upload {
    width: 200px !important;
    border-left: 1px solid #cecdcd;
    border-right: 1px solid #cecdcd;;
    /* align-items: center;
    justify-content: center; */
    box-sizing: border-box;
  }
   .upload-demo-large .el-upload {
    height: auto;
    /* padding-top: 15px; */
  }
  .upload-demo-larger .el-upload {
    height: 115px;
    padding-top: 38px;
  }
  .upload-demo-larger2 .el-upload {
    height: 70px;
    padding-top: 13px;
  }
.letterHight .el-form-item__label {
  line-height: 20px;;
}


</style>